<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>JavaScript第十一课中华人民共和国</title>
    <script src="js/js.js"></script>

</head>

<body>
    <div id="abc">
        bbc
    </div>
    <div>
        <div id="abc">
            abc
        </div>
    </div>

    <div id="test-div">
        <div class="c-red">
            <p id="test-p">JavaScript</p>
            <p>Java</p>
        </div>
        <div class="c-red c-green">
            <p>Python</p>
            <p>Ruby</p>
            <p>Swift</p>
        </div>
        <div class="c-green">
            <p>Scheme</p>
            <p>Haskell</p>
        </div>
    </div>
    <script>


        // 选择<p>JavaScript</p>:
        var js =document.getElementById('test-p');

        console.log(js);

        // 选择<p>Python</p>,<p>Ruby</p>,<p>Swift</p>:
        var arr = document.getElementsByClassName('c-red c-green')[0].innerHTML;

        console.log(arr);

        // 选择<p>Haskell</p>:
        var haskell = document.getElementsByClassName('c-green')[1].getElementsByTagName('p')[1];

        console.log(haskell);

    </script>
</body>

</html>